﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Runtime.InteropServices;

namespace WebViewerTest
{
	/// <summary>
	/// Interaction logic for Window1.xaml
	/// </summary>
	public partial class Window1 : Window
	{
		private Trackball trackball = new Trackball();

		public Window1()
		{
			InitializeComponent();

			camera.Transform = trackball.Transform;
			light.Transform = trackball.Transform;

			trackball.EventSource = mainContent;
			mainContent.Focus();

//			mainContent.MouseDown += delegate { viewport.IsHitTestVisible = false; };
//			mainContent.MouseUp += delegate { viewport.IsHitTestVisible = true; };

			Closed += delegate { browserProxy1.Stop(); };
			Navigate();
		}

		private void url_TextChanged( object sender, TextChangedEventArgs e )
		{
		}

		private void Button_Click( object sender, RoutedEventArgs e )
		{
			Navigate();
		}

		private void Navigate()
		{
			if ( !url.Text.Contains( ':' ) ) url.Text = "http://" + url.Text;
			browserProxy1.Source = new Uri( url.Text );
		}
	}
}
